{% extends "home/common.html" %}
{% block content %}
<!-- //网站头部 -->

<div id="mr-mainbody" class="container mr-mainbody">
    <div class="row">
        <!-- 显示订单列表 -->
        <div id="mr-content" class="mr-content col-xs-12">
            <div id="mrshop" class="mrshop common-home">
                <div class="container_oc">
                    <div class="row">
                        <div id="content_oc" class="col-sm-12">
                            <h1>选择地址</h1>
                            <div class="table-responsive cart-info">
                                <table class="table table-bordered">
                                    <thead>
                                    <tr>
                                        <td></td>
                                        <td class="text-center receive_name">收件人</td>
                                        <td class="text-center receive_tel">收件人电话</td>
                                        <td class="text-center receive_address">收件人地址</td>
                                        <td class="text-center remark">备注</td>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    {% for item in data%}
                                    <tr>
                                        <td>
                                            <input type="radio"
                                                   id="{{item.id}}"
                                                   class="order_box" name="order_box_name">
                                        </td>
                                        <td class="text-center quantity">{{item.receive_name}}</td>
                                        <td class="text-center quantity">{{item.receive_tel}}</td>
                                        <td class="text-center quantity">{{item.receive_address}}</td>
                                        <td class="text-center quantity">{{item.remark}}</td>
                                    </tr>
                                    {% endfor %}
                                    </tbody>
                                </table>
                            </div>
                        </div>
                    </div>
                    <br/><br/>
                    <div class="row">
                        <div class="col-sm-12">
                            <br/>
                            <br/>
                            <div class="buttons">
                                <div class="pull-right">
                                    <a onclick="check()"
                                       class="tigger btn btn-primary btn-primary">确定</a>
                                </div>
                            </div>
                        </div>

                    </div>
                </div>
            </div>
        </div>
        <!-- //显示订单列表 -->
    </div>
</div>
<script type="text/javascript" src="{{url_for('static',filename='home/js/jBox/jquery-1.4.2.min.js')}}"></script>
<script type="text/javascript" src="{{url_for('static',filename='home/js/jBox/jquery.jBox-2.3.min.js')}}"></script>
<link type="text/css" rel="stylesheet" href="{{url_for('static',filename='home/js/jBox/Skins2/Pink/jbox.css')}}"/>
<script type="text/javascript">
    function addUnique(arr, element) {
        if (!arr.includes(element)) {
            arr.push(element);
        }
    }

    function check() {
        var id = document.getElementsByName('order_box_name');
        var value = new Array();
        for (var i = 0; i < id.length; i++) {
            if (id[i].checked) {
                addUnique(value, id[i].id)

            }
        }
        var address_id = value[0];
        window.location.href = '/shopping_cart?address_id=' + address_id
    }


</script>
<!-- // 使用jBox插件实现一个支付对话框 -->
{% endblock %}
